{extends file="../home.html"}
{block name="title"}{$head_title}{/block}
{block name="css"}
<link rel="stylesheet" type="text/css" href="/Public/Css/front/front_css/title.css">
{/block}
{block name="content"}
<div class="title">
	<div class="go_back"></div>
	<p><strong>领取头衔</strong></p>
</div>
{if $title_info.level == 1}
<!--初级头衔-->
 <div class="chuji_container">
	<span class="chuji biaoti"></span>
	<span class="huangguan cj"></span>
	<span class="touxian">{$title_info.title_name}</span>
	 {if $title_info.tag_id == TitleModel::REPLY}
	 <span class="subtitle1">您累计回帖{$title_info.rank_up_num}次，可领取{$title_info.title_name}</span>
	 {elseif $title_info.tag_id == TitleModel::ADMIRE}
	 <span class="subtitle1">您累计赞赏{$title_info.rank_up_num}元，可领取{$title_info.title_name}</span>
	 {elseif $title_info.tag_id == TitleModel::SHARE}
	 <span class="subtitle1">您累计分享{$title_info.rank_up_num}次，可领取{$title_info.title_name}</span>
	 {/if}
	 <span class="toget {if !$title_info.is_have} orange {else} gray {/if}" data-title_id="{$title_info.title_id}">{if !$title_info.is_have} 去领取 {else} 已领取 {/if}</span>
	<!--<span class="toget gray" style="display:none">已领取</span>-->
	<span class="line1"></span><span class="tishi">提示</span><span class="line2"></span>
	 {if $title_info.tag_id == TitleModel::REPLY}
	 <span class="subtitle2">如果您还想领取中级头衔的话，需回帖{$title_info.info.rank_up_num}次</span>
	 {elseif $title_info.tag_id == TitleModel::ADMIRE}
	 <span class="subtitle2">如果您还想领取中级头衔的话，需赞赏{$title_info.info.rank_up_num}元</span>
	 {elseif $title_info.tag_id == TitleModel::SHARE}
	 <span class="subtitle2">如果您还想领取中级头衔的话，需分享{$title_info.info.rank_up_num}次</span>
	 {/if}
</div>

{elseif $title_info.level == 2}
<!--中级头衔-->
 <div class="zhongji_container">
	<span class="zhongji biaoti"></span>
	<span class="huangguan zj"></span>
	<span class="touxian">{$title_info.title_name}</span>
	 {if $title_info.tag_id == TitleModel::REPLY}
	<span class="subtitle1">您累计回帖{$title_info.rank_up_num}次，可领取{$title_info.title_name}</span>
	 {elseif $title_info.tag_id == TitleModel::ADMIRE}
	<span class="subtitle1">您累计赞赏{$title_info.rank_up_num}元，可领取{$title_info.title_name}</span>
	 {elseif $title_info.tag_id == TitleModel::SHARE}
	<span class="subtitle1">您累计分享{$title_info.rank_up_num}次，可领取{$title_info.title_name}</span>
	 {/if}
	<span class="toget {if !$title_info.is_have} orange {else} gray {/if}" data-title_id="{$title_info.title_id}">{if !$title_info.is_have} 去领取 {else} 已领取 {/if}</span>
	<!--<span class="toget gray" style="display:none">已领取</span>-->
	<span class="line1"></span><span class="tishi">提示</span><span class="line2"></span>
	 {if $title_info.tag_id == TitleModel::REPLY}
	 <span class="subtitle2">如果您还想领取高级头衔的话，需回帖{$title_info.info.rank_up_num}次</span>
	 {elseif $title_info.tag_id == TitleModel::ADMIRE}
	 <span class="subtitle2">如果您还想领取高级头衔的话，需赞赏{$title_info.info.rank_up_num}元</span>
	 {elseif $title_info.tag_id == TitleModel::SHARE}
	 <span class="subtitle2">如果您还想领取高级头衔的话，需分享{$title_info.info.rank_up_num}次</span>
	 {/if}
</div>


{elseif $title_info.level == 3}
<!--高级头衔-->
<div class="gaoji_container">
	<span class="gaoji biaoti"></span>
	<span class="huangguan gj"></span>
	<span class="touxian">{$title_info.title_name}</span>
	{if $title_info.tag_id == TitleModel::REPLY}
	<span class="subtitle1">您累计回帖{$title_info.rank_up_num}次，可领取{$title_info.title_name}</span>
	{elseif $title_info.tag_id == TitleModel::ADMIRE}
	<span class="subtitle1">您累计赞赏{$title_info.rank_up_num}次，可领取{$title_info.title_name}</span>
	{elseif $title_info.tag_id == TitleModel::SHARE}
	<span class="subtitle1">您累计分享{$title_info.rank_up_num}次，可领取{$title_info.title_name}</span>
	{/if}
	<span class="toget {if !$title_info.is_have} orange {else} gray {/if}" data-title_id="{$title_info.title_id}">{if !$title_info.is_have} 去领取 {else} 已领取最高头衔 {/if}</span>
	<span class="line1"></span><span class="tishi">提示</span><span class="line2"></span>
	<span class="subtitle2">如果您还想领取特殊头衔的话，需联系客服</span>
</div>

{/if}
<!--成功弹框-->
<div class="Popupsuccess">
	<i class="done"></i>
	<p>领取成功</p>
</div>
<!--失败弹框-->
<div class="Popupdefeat">
	<div class="defeat"></div>
	<p>领取失败，回帖次数不够哦!</p>
</div>
{/block}
{block name="js"}
<script>
	var is_click = false;
</script>
{literal}
<script type="text/javascript">
	// $('.return_icon').on('click',function(){
	// 	window.location.href='/FrontTitle/title_index';
	// });

	$('.orange').on('click',function () {
		if(is_click == true) return;
		is_click = true;
		 var title_id = $(this).attr('data-title_id');
		console.log(title_id)

		$.ajax({
			type:'post',
			url:'/FrontTitle/receive_title',
			data:{title_id:title_id},
			success:function (data) {
				if(data.code == 1){
					$('.Popupsuccess').find('p').html(data.msg);
					$(".toget").attr("class", "toget gray");
					$(".toget").html("已领取");

					$('.Popupsuccess').fadeIn(1500);
					$('.Popupsuccess').fadeOut(2000);
				}else{
					console.log(data.msg)
					$('.Popupdefeat').find('p').html(data.msg);
					$('.Popupdefeat').fadeIn(1500);
					$('.Popupdefeat').fadeOut(2000);
				}
				is_click = false;
			}
		})




	})
</script>
{/literal}
{/block}
